<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="java.util.Iterator"%>
<%@page import="edu.intprog.egreeting.beans.GreetingHistory"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>E-Greeting: Greetings history</title>
</head>
<body bgcolor="#99FFCC">
<table id="historyTable" border="5">
<% 
    @SuppressWarnings("unchecked")
	List<GreetingHistory> history = (List<GreetingHistory>) request.getAttribute("userHistory");
	Iterator<GreetingHistory>  listIt = history.iterator();
	while (listIt.hasNext())
	{
		GreetingHistory gh = listIt.next();	
	%>
<tr>
<td>
<form action="ReshowGreetingServlet" method="post">
<table border="0">
<tr>
<td>Greeting title</td>
<td><input type="text" name="title" value="<%= gh.get_title() %>" readonly /></td>
<td>Sender E-Mail</td>
<td><input type="text" name="senderEmail" value="<%=gh.get_senderEmail() %>" readonly /></td>
</tr>
<tr>
<td>Sender name or nickname</td>
<td><input type="text" name="senderName" value="<%=gh.get_senderName() %>" readonly /></td>
<td>Recipient E-Mail</td>
<td><input type="text" name="recipientEmail" value="<%=gh.get_recipientEmail() %>" readonly /></td>
</tr>
<tr>
<td>Recipient name or nickname</td>
<td><input type="text" name="recipientName" value="<%=gh.get_recipientName() %>" readonly /> <br/></td>
<td>Blessing</td>
<td><input type="text" name="blessing" value="<%=gh.get_blessing() %>" readonly /></td>
</tr>
<tr>
<td>Personal blessing</td>
<td><input type="text" name="personalBlessing" value="<%=gh.get_personalBlessing() %>" readonly />  <br/></td>
<td>Background image</td>
<td><input type="text" name="backImage" value="<%=gh.get_backgroundImage() %>" readonly /></td> 
</tr>
<tr>
<td>Foreground image</td>
<td><input type="text" name="foreImage" value="<%=gh.get_greetingImage() %>" readonly /></td> 
<td>Background Music</td>
<td><input type="text" name="backMusic" value="<%=gh.get_backgroundSound() %>" readonly /> <br/></td>
</tr>
<tr>
<td>Sent Date</td>
<td><input type="text" name="sentDate" value="<%=gh.get_sentDate() %>" readonly /></td> 
<td>Approved</td>
<td><input type="checkbox" name="approved" <%=gh.is_approved()? "checked":"" %> disabled /></td> 
</tr>
<tr>
<td>Approved Date</td>
<td><input type="text" name="approvedDate" value="<%=gh.get_approvedDate()!=null? gh.get_approvedDate():"" %>" readonly /> <br/></td> 
</tr>
</table>
<br/>
<input type="submit" name="resend" value="Resend" />
<input type="submit" name="preview" value="Preview" />
</form>
</td>
</tr>
<%	} %>
</table>
</body>
</html>